{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf350
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\margl1440\margr1440\vieww9000\viewh8400\viewkind0
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural

\f0\fs24 \cf0 #include	<stdio.h>\
#include    <sys/time.h>\
#include    <signal.h>\
\
/*\
 *      set_ticker.c\
 *          set_ticker( number_of_milliseconds )\
 *                   arranges for the interval timer to issue\
 *                   SIGALRM's at regular intervals\
 *          returns -1 on error, 0 for ok\
 *\
 *      arg in milliseconds, converted into micro seoncds\
 */\
int set_ticker( int n_msecs )\
\{\
    struct itimerval new_timeset;\
    long    n_sec, n_usecs;\
\
    n_sec = n_msecs / 1000 ;\
    n_usecs = ( n_msecs % 1000 ) * 1000L ;\
\
    new_timeset.it_interval.tv_sec  = n_sec;        /* set reload  */\
    new_timeset.it_interval.tv_usec = n_usecs;      /* new ticker value */\
    new_timeset.it_value.tv_sec     = n_sec  ;      /* store this   */\
    new_timeset.it_value.tv_usec    = n_usecs ;     /* and this     */\
\
    return setitimer(ITIMER_REAL, &new_timeset, NULL);\
\}\
}